package com.yeswater.multithread.chapter1.test1_12.test1;

import org.junit.Test;

import java.sql.SQLOutput;
import java.util.concurrent.TimeUnit;

/**
 * author : yeswater
 * date : 2023/10/19
 */

public class RunTest {

    @Test
    public void test1() {
        try {
            MyThread t1 = new MyThread();
            t1.start();
            Thread.sleep(5000);

            t1.suspend();
            System.out.println("A= " + System.currentTimeMillis() + " i=" + t1.getI());
            Thread.sleep(5000);
            System.out.println("A= " + System.currentTimeMillis() + " i=" + t1.getI());

            t1.resume();
            Thread.sleep(5000);

            t1.suspend();
            System.out.println("B= " + System.currentTimeMillis() + " i=" + t1.getI());
            Thread.sleep(5000);
            System.out.println("B= " + System.currentTimeMillis() + " i=" + t1.getI());
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

}
